package com.spj.service.impl;

import com.spj.dao.UserDao;
import com.spj.entity.QueryCondition;
import com.spj.entity.User;
import com.spj.service.UserServiceDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author :spj
 * @Date:2022/4/14
 * @description:
 */
@Service
public class UserServiceDaoImpl implements UserServiceDao {
    @Autowired
    UserDao dao;

    @Override
    public User findUserByName(String name) {
        return dao.selectUserByName(name);
    }

    @Override
    public int findUserRoleIdByName(String name) {
        return dao.selectUserRoleIdByName(name);
    }

    @Override
    public List<User> findtAllUsers(QueryCondition queryCondition) {
        return dao.selectAllUsers(queryCondition);
    }

    @Override
    public User checkUser(String account, String password) {
        return dao.selectUserByUser(account,password);
    }

    @Override
    public void deleteUserById(int id) {
        dao.deleteUserById(id);
    }

    @Override
    public void updateUser(User user) {
        dao.updateUser(user);
    }

    @Override
    public void addUser(User user) {
        dao.insertUser(user);
    }
}
